home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
LIB
/
DESK
/
CORE
/
Desk
/
h_doc
/
Font
< prev
next >
Wrap
Text File
|
1996-06-25
|
10KB
|
369 lines
/*
#### # # # #
# # # # # The FreeWare C library for
# # ## ### # # # # ### RISC OS machines
# # # # # # # # # # # ___________________________________
# # #### ### ## # # # #
# # # # # # # # # # Please refer to the accompanying
#### ### #### # # ##### # ### documentation for conditions of use
________________________________________________________________________
File: Font.h
Author: Copyright © 1993 Shaun Blackmore, Julian Smith
Version: 1.02 (08 Jul 1995)
Purpose: Assembler SWI veneers for the Font Manager
NOTE that some names are not strictly 'DeskLib' style, to keep
them consistent with the SWIs they represent ("Converttopoints",
etc). However, macros with 'DeskLib' naming are provided to allow
either naming style to be used.
Mods: 08 Jul 1995 - Julian Smith - Added Desk_Font_Paint3 for use with RISC
OS 3. Also various macros for the
'plottype' argument of Desk_Font_Paint3.
*/
#ifndef __Desk_Font_h
#define __Desk_Font_h
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __Desk_Core_h
#include "Desk.Core.h"
#endif
#ifndef __Desk_Wimp_h
#include "Desk.Wimp.h"
#endif
typedef int Desk_font_handle;
typedef struct
{
char name[128]; /* NOTE: Desk_Font_ReadDefn returns this string CR terminated */
int xsize, ysize, xres, yres;
int age, usage;
} Desk_font_defn;
typedef struct
{
int minx, miny, maxx, maxy;
} Desk_font_info;
/*
Used with Desk_Font_ReadInfo
*/
typedef struct
{
char *s; /* string */
int x; /* in/out, in 1/72000s of an inch */
int y; /* in/out, in 1/72000s of an inch */
int split; /* in/out: space char, or -1 */
/* on exit, = count of space or printable */
int term; /* in/out: index into s */
} Desk_font_string;
/*
Used with Desk_Font_FindCaret, Desk_Font_StringWidth.
*/
typedef struct
{
int background, foreground;
} Desk_font_colours;
typedef struct
{
Desk_font_handle font;
Desk_font_colours colour;
int offset;
} Desk_font_state;
/*
Used with Desk_Font_CurrentFont and Desk_Font_FutureFont.
*/
typedef struct
{
char offset;
char thresholds[15];
} Desk_font_thresholds;
/*
Used with Desk_Font_ReadThresholds
*/
/* Font usage array (Desk_font_array)
* This array is indexed by the font handle - each entry contains a
* count of how many times we have FindFont'd this font. This is used
* mainly by the template system (Desk_Wimp_LoadTemplate).
* See Desk_Font_LoseAllFonts
* For convenience, this is defined in Wimp.h (it is mainly used for
* template loading)
*
* typedef struct
* {
* char fonts[256];
* } Desk_font_array;
*/
extern void Desk_Font_CacheAddr(int *version, int *cacheused, int *cachesize); /* PRMS 3-418 */
extern void Desk_Font_ListFonts(char *name, int *count); /* PRMS 3-450 */
extern void Desk_Font_ReadDefn(Desk_font_handle font, Desk_font_defn *defn); /* PRMS 3-424 */
extern void Desk_Font_ReadInfo(Desk_font_handle font, Desk_font_info *info); /* PRMs 3-426 */
extern void Desk_Font_ConverttoOS(int x, int y, int *xout, int *yout); /* PRMs 3-438 */
#define Desk_Font_ConvertToOS Desk_Font_ConverttoOS /* PRMs 3-438 */
/*
Converts x and y from millipoints to OS coors.
(normally 400millipoints = 1 OS unit).
Both xout and yout must be valid addresses, even if you are only
interested in (say) xout.
*/
extern void Desk_Font_Converttopoints(int x, int y, int *xout, int *yout); /* PRMs 3-439 */
#define Desk_Font_ConvertToPoints Desk_Font_Converttopoints /* PRMs 3-439 */
extern void Desk_Font_FindFont(Desk_font_handle *font, const char *name,
int xsize, int ysize, int xres, int yres); /* PRMs 3-419 */
extern void Desk_Font_LoseFont(Desk_font_handle font); /* PRMs 3-423 */
extern void Desk_Font_LoseAllFonts(Desk_font_array *fonts);
/* Desk_Font_LoseAllFonts
* Given a font usage array, this function calls Desk_Font_Lose for all fonts
* used, and sets the font usage array to zeros. See above for info on
* how a font usage array is organised...
*/
extern void Desk_Font_SetFont(Desk_font_handle font); /* PRMs 3-440 */
extern void Desk_Font_CurrentFont(Desk_font_state *state); /* PRMs 3-441 */
extern void Desk_Font_FutureFont(Desk_font_state *state); /* PRMs 3-443 */
extern void Desk_Font_Paint(char *, int options, int x, int y); /* PRMs 3-429 */
/*
Use Desk_Font_Paint3 to use RISC OS 3 features.
*/
extern void Desk_Font_Caret(int colour, int height, int flags, int x, int y); /* PRMs 3-436 */
extern void Desk_Font_FindCaret(Desk_font_string *string); /* PRMs 3-444 */
extern void Desk_Font_FindCaretJ(Desk_font_string *s, int xoffset, int yoffset); /* PRMs 3-461 */
extern void Desk_Font_StringWidth(Desk_font_string *string); /* PRMs 3-427 */
extern void Desk_Font_CharBBox(Desk_font_handle font, char c,
int flags, Desk_font_info *info); /* PRMs 3-446 */
extern void Desk_Font_StringBBox(char *string, Desk_font_info *info);/* PRMs 3-463 */
extern void Desk_Font_ReadScaleFactor(int *xscale, int *yscale);/* PRMs 3-448 */
extern void Desk_Font_SetFontColours(Desk_font_handle font,
int Desk_back_colour, int Desk_fore_colour,
int offset);
extern void Desk_Font_SetPalette(int Desk_back_log, int Desk_fore_log,
int offset,
int Desk_back_phys, int Desk_fore_phys);
extern void Desk_Font_ReadThresholds(Desk_font_thresholds *t);
extern void Desk_Font_SetThresholds(Desk_font_thresholds *t);
#define Desk_font_justify_NONE (0)
/*
No justification
*/
#define Desk_font_justify_CURSOR (1<<0)
/*
Justify between startpos and last graphics position.
Not to be used with Desk_font_justify_COORBLOCK or
Desk_font_justify_NONE.
*/
#define Desk_font_justify_COORBLOCK (1<<5)
/*
Justify according to 8-word coordinate pointed to by r5
Not to be used with Desk_font_justify_CURSOR,
Desk_font_justify_NONE or Desk_font_plot_OSCOORS.
*/
#define Desk_font_rubout_NONE (0)
/*
Don't do a rubout.
*/
#define Desk_font_rubout_CURSOR (1<<1)
/*
Use the last two graphics cursor positions to define
the rubout box.
*/
#define Desk_font_rubout_COORBLOCK (1<<1 + 1<<5)
/*
Rubout box is defined by the Desk_font_coorblock pointed to by r5.
Not RISC OS 2.
Not to be used with Desk_font_plot_OSCOORS.
*/
#define Desk_font_plot_OSCOORS (1<<4)
/*
Coors are in OS coors.
Not to be used with Desk_font_justify_COORBLOCK or
Desk_font_rubout_COORBLOCK.
*/
#define Desk_font_plot_TRANSMATRIX (1<<6)
/*
Use transformation matrix pointed to by r6
Not RISC OS 2.
Not to be used with Desk_font_plot_OSCOORS.
*/
#define Desk_font_STRLEN (1<<7)
/*
r7 is length of string
Not RISC OS 2
*/
#define Desk_font_plot_CURRENTHANDLE (1<<8)
/*
Use current handle iff r0=0
Not RISC OS 2
*/
#define Desk_font_plot_KERN (1<<9)
/*
Kern the string.
Not RISC OS 2.
*/
typedef struct {
struct {
Desk_wimp_point space;
Desk_wimp_point letter;
}
offsets;
Desk_wimp_rect rubout;
}
Desk_font_coorblock;
/*
Used with Desk_Font_Paint3
*/
typedef struct {
struct {
int xx; /* These names may not be right... */
int xy;
int yx;
int yy;
}
scale;
Desk_wimp_point translate;
}
Desk_font_transformation;
/*
Used with Desk_Font_Paint3
*/
void Desk_Font_Paint3(
Desk_font_handle font,
const char *string,
unsigned int plottype,
int x,
int y,
Desk_font_coorblock *coorblock,
Desk_font_transformation *transformation,
int length
);
/*
Veneer for the RISC OS 3 Desk_Font_Paint SWI. Note that Desk_Font_Paint doesn't
support any of the RISC OS 3 features.
See PRM 3-429
'plottype' should be a combination (using '|' rather than '+', because
some bits are set in more than one macro) of Desk_font_justify_NONE,
Desk_font_justify_CURSOR, Desk_font_justify_COORBLOCK, Desk_font_rubout_NONE,
Desk_font_rubout_CURSOR, Desk_font_rubout_COORBLOCK, Desk_font_plot_OSCOORS,
Desk_font_plot_TRANSMATRIX, Desk_font_STRLEN, Desk_font_plot_CURRENTHANDLE,
Desk_font_plot_KERN.
There are rather complicated rules for which of these are allowed at the
same time. The following is what I think is the situation.
You can use:
Only one of: Desk_font_justify_NONE, Desk_font_justify_CURSOR,
Desk_font_justify_COORBLOCK
Only one of: Desk_font_rubout_NONE, Desk_font_rubout_CURSOR, Desk_font_rubout_COORBLOCK
In addition, you may not use Desk_font_plot_OSCOORS with any of
Desk_font_justify_COORBLOCK, Desk_font_rubout_COORBLOCK, Desk_font_plot_TRANSMATRIX
Another way of looking at this, is:
You can use just one Desk_font_justify_*
You can use just one Desk_font_rubout_*
You can only use Desk_font_plot_OSCOORS if you don't use any of:
Desk_font_justify_COORBLOCK, Desk_font_rubout_COORBLOCK, Desk_font_plot_TRANSMATRIX
Note that both Desk_font_justify_COORBLOCK and Desk_font_rubout_COORBLOCK use
Desk_wimp_rect 'coorblock'. If you use either of these, 'coorblock' mustn't
be NULL.
Just for fun, here's a run-down of the justification and rubout bits in
Desk_Font_Paint's r2:
Bit
5 0 | Justification
----+--------------
0 0 | None
0 1 | Cursor
1 0 | Coor block r5
1 1 | Illegal
Bit
5 1 | Rubout
----+--------------
0 0 | None
0 1 | Cursor
1 0 | Illegal
1 1 | Coor block r5
These are rather unsymetrical...
*/
#ifdef __cplusplus
}
#endif
#endif